home *** CD-ROM | disk | FTP | other *** search
/ Eagles Nest BBS 8 / Eagles_Nest_Mac_Collection_Disc_8.TOAST / Developer Tools⁄Additions / UFullTEView / UFullTEView.a next >
Text File  |  1990-10-18  |  6KB  |  238 lines

  1. ; This is part of the UFullTEView Version 2.3 package.
  2. ; See the Pascal units for more details.
  3.  
  4.  
  5.                     SEG            'FullTERes'
  6.                     
  7.                     include        'Traps.a'
  8.                     include        'ToolEqu.a'
  9.                     include        'QuickEqu.a'
  10.  
  11. ; DoHigh takes care of highlighting text with mouse movement, avoiding the
  12. ;     flashing that TESetSelect would produce.
  13.  
  14. DOHIGH                PROC        EXPORT
  15.                     LINK        A6,#0
  16.                     MOVEM.L        D3-D7/A2-A5,-(SP)
  17.                     
  18.                     ;12(A6)        theTEPtr
  19.                     ;10(A6)        starting offset
  20.                     ;8(A6)        ending offset
  21.                     
  22.                     MOVE.L        12(A6),A3
  23.                     MOVE.W        10(A6),D3
  24.                     MOVE.W        8(A6),D4
  25.                     MOVE.W        #1,D7
  26.                     MOVE.L        TEDoText,A0
  27.                     JSR            (A0)
  28.                     
  29.                     MOVEM.L        (SP)+,D3-D7/A2-A5
  30.                     UNLK        A6
  31.                     MOVE.L        (SP)+,A1
  32.                     ADD.L        #8,SP
  33.                     JMP            (A1)
  34.                     ENDP
  35.  
  36.  
  37. ; These next two routines provide for a slanted cursor within italicized text…
  38.  
  39. DRAWHIGHPROC        PROC        EXPORT
  40.                     IMPORT        ISITALIC
  41.                     LINK        A6,#0
  42.                     MOVEM.L        D3-D7/A2-A6,-(SP)
  43.                     MOVE.L        4(A6),A2        ;addr of selection's rectangle
  44.                     
  45.                     MOVE.W        left(A2),D3        ;D3 = topleft.h
  46.                     MOVE.W        D3,D4            ;D4 = bottomleft.h
  47.                     MOVE.W        right(A2),D6    ;D6 = topright.h
  48.                     MOVE.W        D6,D7            ;D7 = bottomright.h
  49.                     
  50.                     CMP.W        #-32700,D3
  51.                     BLT.B        TryRight        ;Don't bother if -MAXINT
  52.  
  53.                     SUBQ.L        #2,SP            ;room for IsItalic's result
  54.                     MOVE.W        D4,-(SP)
  55.                     MOVE.W        bottom(A2),D5
  56.                     ADD.W        top(A2),D5
  57.                     ASR.W        #1,D5
  58.                     MOVE.W        D5,-(SP)        ;half the height
  59.                     MOVE.L        A3,-(SP)        ;TEPtr
  60.                     JSR            ISITALIC
  61.                     
  62.                     MOVE.W        (SP)+,D1        ;get result of IsItalic
  63.                     BTST        #8,D1
  64.                     BZ.B        TryRight        ;0 = not italic
  65.                     
  66.                     MOVE.W        bottom(A2),D5    ;italic -> shift the top
  67.                     SUB.W        top(A2),D5
  68.                     ASR.W        #1,D5
  69.                     ADD.W        D5,D3
  70.                     SUB.W        #2,D3            ;and shift a bit leftward
  71.                     SUB.W        #2,D4
  72.  
  73. TryRight:            CMP.W        #32700,D6
  74.                     BGT.B        DrawHighlight    ;Don't bother if MAXINT
  75.  
  76.                     SUBQ.L        #2,SP            ;room for IsItalic's result
  77.                     MOVE.W        D7,-(SP)
  78.                     MOVE.W        bottom(A2),D5
  79.                     ADD.W        top(A2),D5
  80.                     ASR.W        #1,D5
  81.                     MOVE.W        D5,-(SP)        ;half the height
  82.                     MOVE.L        A3,-(SP)        ;TEPtr
  83.                     JSR            ISITALIC
  84.                     
  85.                     MOVE.W        (SP)+,D1        ;get result of IsItalic
  86.                     BTST        #8,D1
  87.                     BZ.B        DrawHighlight    ;0 = not italic
  88.                     
  89.                     MOVE.W        bottom(A2),D5    ;italic -> shift the top
  90.                     SUB.W        top(A2),D5
  91.                     ASR.W        #1,D5
  92.                     ADD.W        D5,D6
  93.                     SUB.W        #2,D6            ;and shift a bit leftward
  94.                     SUB.W        #2,D7
  95.                     
  96. DrawHighlight        SUBQ.L        #4,SP            ;room for result
  97.                     _OpenPoly
  98.                     MOVE.L        (SP)+,A3        ;handle to Polygon
  99.                     MOVE.W        D4,-(SP)
  100.                     MOVE.W        bottom(A2),-(SP)
  101.                     _MoveTo
  102.                     MOVE.W        D3,-(SP)
  103.                     MOVE.W        top(A2),-(SP)
  104.                     _LineTo
  105.                     MOVE.W        D6,-(SP)
  106.                     MOVE.W        top(A2),-(SP)
  107.                     _LineTo
  108.                     MOVE.W        D7,-(SP)
  109.                     MOVE.W        bottom(A2),-(SP)
  110.                     _LineTo
  111.                     _ClosePgon
  112.                     MOVE.L        A3,-(SP)
  113.                     _InvertPoly
  114.                     MOVE.L        A3,-(SP)
  115.                     _KillPoly
  116.                     
  117.                     MOVEM.L        (SP)+,D3-D7/A2-A6
  118.                     UNLK        A6
  119.                     ADD.L        #4,SP
  120.                     RTS
  121.                     ENDP
  122.  
  123.  
  124. DRAWCARETPROC        PROC        EXPORT
  125.                     IMPORT        ISITALIC
  126.                     LINK        A6,#0
  127.                     MOVEM.L        D3-D7/A2-A6,-(SP)
  128.                     MOVE.L        4(A6),A2        ;addr of caret's rectangle
  129.                     MOVE.W        left(A2),D3        ;D3 = topleft.h
  130.                     MOVE.W        D3,D4            ;D4 = bottomleft.h
  131.  
  132.                     SUBQ.L        #2,SP            ;room for IsItalic's result
  133.                     MOVE.W        D4,-(SP)
  134.                     MOVE.W        bottom(A2),D5
  135.                     ADD.W        top(A2),D5
  136.                     ASR.W        #1,D5
  137.                     MOVE.W        D5,-(SP)        ;half the height
  138.                     MOVE.L        A3,-(SP)        ;TEPtr
  139.                     JSR            ISITALIC
  140.                     
  141.                     MOVE.W        (SP)+,D1        ;get result of IsItalic
  142.                     BTST        #8,D1
  143.                     BZ.B        DrawCaret        ;0 = not italic
  144.                     
  145.                     MOVE.W        bottom(A2),D5    ;italic -> shift the top
  146.                     SUB.W        top(A2),D5
  147.                     ASR.W        #1,D5
  148.                     ADD.W        D5,D3
  149.                     SUB.W        #2,D3            ;and shift a bit leftward
  150.                     SUB.W        #2,D4
  151.                     
  152. DrawCaret            SUBQ.L        #4,SP            ;room for result
  153.                     _OpenPoly
  154.                     MOVE.L        (SP)+,A3        ;handle to Polygon
  155.                     MOVE.W        D4,-(SP)
  156.                     MOVE.W        bottom(A2),-(SP)
  157.                     _MoveTo
  158.                     MOVE.W        D3,-(SP)
  159.                     MOVE.W        top(A2),-(SP)
  160.                     _LineTo
  161.                     MOVE.W        #1,-(SP)
  162.                     MOVE.W        #0,-(SP)
  163.                     _Line
  164.                     ADDQ.W        #1,D4
  165.                     MOVE.W        D4,-(SP)
  166.                     MOVE.W        bottom(A2),-(SP)
  167.                     _LineTo
  168.                     _ClosePgon
  169.                     MOVE.L        A3,-(SP)
  170.                     _InvertPoly
  171.                     MOVE.L        A3,-(SP)
  172.                     _KillPoly
  173.                     
  174.                     MOVEM.L        (SP)+,D3-D7/A2-A6
  175.                     UNLK        A6
  176.                     ADD.L        #4,SP
  177.                     RTS
  178.                     ENDP
  179.  
  180.  
  181. ; The following form the glue for using the sub/superscript options of
  182. ; UFullTEView. You do not need to include these if you have set SubSuper to
  183. ; FALSE in UFullTEView.p.
  184.  
  185. SUBSUPERDRAWGLUE    PROC        EXPORT
  186.                     IMPORT        NEWDRAWPROC
  187.                     MOVEM.L        D0-D7/A0-A6,-(SP)
  188.                     MOVE.W        D0,-(SP)        ;starting offset
  189.                     MOVE.W        D1,-(SP)        ;length
  190.                     MOVE.L        A0,-(SP)        ;pointer to text
  191.                     MOVE.L        A3,-(SP)        ;TEPtr
  192.                     MOVE.L        A4,-(SP)        ;TEHandle
  193.                     JSR            NEWDRAWPROC
  194.                     MOVEM.L        (SP)+,D0-D7/A0-A6
  195.                     RTS
  196.                     ENDP
  197.                     
  198.                     
  199.                     
  200. OLDDRAWPROC            PROC        EXPORT
  201.                     LINK        A6,#0
  202.                     MOVEM.L        D3-D7/A2-A5,-(SP)
  203.                     
  204.                     ;8(A6)        theTEHdl
  205.                     ;12(A6)        theTEPtr
  206.                     ;16(A6)        theText
  207.                     ;20(A6)        length
  208.                     ;22(A6)        theStart
  209.                     ;24(A6)        previousDrawProc
  210.  
  211.                     ; First set up registers for another custom DrawHook
  212.                     MOVE.W        22(A6),D0
  213.                     MOVE.W        20(A6),D1
  214.                     MOVE.L        16(A6),A0
  215.                     MOVE.L        12(A6),A3
  216.                     MOVE.L        8(A6),A4
  217.                     
  218.                     MOVE.L        SP,A4        ;save SP
  219.                     
  220.                     ; Now push parameters (in case Previous is DrawText)
  221.                     MOVE.L        16(A6),-(SP)
  222.                     MOVE.W        22(A6),-(SP)
  223.                     MOVE.W        20(A6),-(SP)
  224.                     
  225.                     ; Call the previous Drawing proc
  226.                     MOVE.L        24(A6),A1
  227.                     JSR            (A1)
  228.                     MOVE.L        A4,SP        ;restore SP (in case Previous is not DrawText)
  229.                     
  230.                     MOVEM.L        (SP)+,D3-D7/A2-A5
  231.                     UNLK        A6
  232.                     MOVE.L        (SP)+,A1
  233.                     ADD.L        #20,SP
  234.                     JMP            (A1)
  235.                     ENDP
  236.  
  237.                     END
  238.